﻿@model TopCustomerReportLineModel

@{
    var parentModel = ViewData["Parent"] as TopCustomersReportModel;
}

<datagrid id="best-customers-grid" class="h-100" allow-resize="true" allow-column-reordering="true">
    <datasource read="@Url.Action("ReportTopCustomersList")" />
    <paging position="Both" show-size-chooser="true" />
    <sorting enabled="true" allow-unsort="true" allow-multisort="false">
        <sort by="OrderTotal" descending="true" />
    </sorting>
    <toolbar>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.ToggleSearchPanel" class="btn btn-light btn-icon">
                <i class="fa fa-fw fa-filter"></i>
            </button>
        </toolbar-group>
    </toolbar>
    <search-panel>
        <partial name="Grids/_Grid.BestCustomers.Search" model="parentModel" />
    </search-panel>
    <columns>
        <column for="CustomerId" sortable="false" halign="center" visible="false" type="string" />
        <column for="Email" hideable="false" sortable="false">
            <display-template>
                <a :href="item.row.EditUrl" class="text-truncate">
                    {{ item.value }}
                </a>
            </display-template>
        </column>
        @if (ViewBag.UsernamesEnabled)
        {
            <column for="Username" sortable="false" />
        }
        <column for="FullName" sortable="false" />
        <column for="Active" halign="center" sortable="false" />
        <column for="LastActivityDate" sortable="false" />
        <column for="OrderCount" halign="center" />
        <column for="OrderTotal" halign="right" />
    </columns>
</datagrid>